package com.deplume.ssm.service.impl.admin;

import com.deplume.ssm.common.Page;
import com.deplume.ssm.mapper.admin.ICompanyRelativeMapper;
import com.deplume.ssm.pojo.admin.Company;
import com.deplume.ssm.pojo.admin.CompanyDetail;
import com.deplume.ssm.pojo.extra.ChangeStatus;
import com.deplume.ssm.service.inface.admin.ICompanyRelativeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by libing on 2016/7/26.
 */
@Service("companyRelativeService")
public class CompanyRelativeServiceImpl implements ICompanyRelativeService {

    @Autowired
    ICompanyRelativeMapper companyRelativeMapper;

    @Override
    public List<CompanyDetail> returnCompanyInfo() throws Exception {
        return companyRelativeMapper.returnCompanyInfo();
    }

    @Override
    public List<CompanyDetail> returnCompanyInfos(Page page) throws Exception {
        return companyRelativeMapper.returnCompanyInfos(page);
    }

    @Override
    public void changeStatus(ChangeStatus changeStatus) throws Exception {
        companyRelativeMapper.changeStatus(changeStatus);
    }

    @Override
    public List<Company> returnCompanyUsers(Page page) throws Exception {
        return companyRelativeMapper.returnCompanyUsers(page);
    }

    @Override
    public void deleteSelectedItems(Integer[] items_id) throws Exception {
        /*
        * 删除之前
        * */
        companyRelativeMapper.deleteSelectedItems(items_id);
    }

    @Override
    public void deleteCompanyUserById(Integer id) throws Exception {
        companyRelativeMapper.deleteCompanyUserById(id);
    }

    @Override
    public List<Company> returnCompanyUsersByText(Page page) throws Exception {
        List<Company> list = companyRelativeMapper.returnCompanyUsersByText(page);
        return list;
    }

    @Override
    public CompanyDetail selectCompanyDetail(int companyId) throws Exception {
        return companyRelativeMapper.selectCompanyDetail(companyId);
    }

    @Override
    public int returnCityId(String cityName) throws Exception {
        return companyRelativeMapper.returnCityId(cityName);
    }

    @Override
    public void editAllCompanyInfo(Company company) throws Exception {
        companyRelativeMapper.editAllCompanyInfo(company);
    }

    @Override
    public int selectMainIndustryId(String mainIndustryName) throws Exception {
        System.out.println("mainIndustryName===========:"+mainIndustryName);
        return companyRelativeMapper.selectMainIndustryId(mainIndustryName);
    }

    @Override
    public int selectCompanySizeId(String companySizeName) throws Exception {
        return companyRelativeMapper.selectCompanySizeId(companySizeName);
    }

    @Override
    public int selectCompanyPropertyId(String companyPropertyName) throws Exception {
        return companyRelativeMapper.selectCompanyPropertyId(companyPropertyName);
    }

    @Override
    public void insertSecIndustry(int companyDetailId, List<String> list) throws Exception {
        companyRelativeMapper.insertSecIndustry(companyDetailId,list);
    }

    @Override
    public void deleteSecIndustry(int companyDetailId) throws Exception {
        companyRelativeMapper.deleteSecIndustry(companyDetailId);
    }

    @Override
    public void updateCompanyDetailInfo(CompanyDetail companyDetail) throws Exception {
        companyRelativeMapper.updateCompanyDetailInfo(companyDetail);
    }

    @Override
    public void updateCompanyHeadImg(CompanyDetail companyDetail) throws
            Exception
    {
        companyRelativeMapper.updateCompanyHeadImg(companyDetail);
    }
}
